Skip to content

feat(framework): post-merge queues the quality follow-ups (#556)#558

Merged
suleimansh merged 1 commit into
mainfrom
feat/post-merge-todo-entries-556
Jul 15, 2026
Merged

feat(framework): post-merge queues the quality follow-ups (#556)#558
suleimansh merged 1 commit into
mainfrom
feat/post-merge-todo-entries-556

Conversation

@suleimansh

Copy link
Copy Markdown
Member

Closes #556

Follow-up to #557, which synced the first ```md block of #326. This is the second block.

Draft on purpose: it needs a yes on the flattening below before it should land. Everything else is green.

On setReadyForMerge(), a --post-merge run used to fire maintainability, readability and security-audit as three child framework prompt runs, back to back, on the spot. It now fires one short turn that appends "Apply preset X on the changes introduced by <session>" to the session TODO file and lets the backlog loop (#323/#538) pick them up. That is what the doc says, and it is much cheaper: a few TODO lines instead of three full preset passes serialized on the same git index.

What it sends now, rendered from the real template:

TODO_FILE: `TODO_<SESSION_NAME>.agent.md`

## Maintenance

If the changes introduced by add-oauth aren't trivial and have refactor potential, add the following to <TODO_FILE>
- "Apply preset `maintainability` on the changes introduced by add-oauth"
- "Apply preset `readability` on the changes introduced by add-oauth"

If the changes introduced by add-oauth can potentially lead to security issues, add the following to <TODO_FILE>
- "Apply preset `security_audit` on the changes introduced by add-oauth"

The readability entry only appears under Technical control, per the doc. That setting already existed as a preference, a --technical flag and a Global options toggle, it just never reached the prompts, so TfContext gains settings.technical_control and session_name. The session name is carried on run state: set before the first change, read after the run.

--eco-auto-maintenance does something again. #326 moved the maintenance section out of the system prompt, which left the flag inert (#555). The post-merge prompt is exactly that section, so the flag now skips it.

The one thing that needs a call

The post-merge block cannot be synced verbatim. It nests ${{ tf.session_name }} inside the outer ${{ ... }} and puts backticks inside a backtick template literal. FRAGMENT is non-greedy, so the outer fragment closes on the inner }} and the rest is not valid JS. It throws today, with or without the new context fields:

[framework] template fragment ${{ !tf.settings.technical_control ? '' : (`
- "Apply preset `readability` on the changes introduced by ${{ tf.session_name }} failed to evaluate: Unexpected identifier 'readability'

So it is flattened to one fragment, same logic, same output:

${{ tf.settings.technical_control ? '- "Apply preset `readability` on the changes introduced by ' + tf.session_name + '"\n' : '' }}

That is prompt text, so it wants a review round before it lands rather than after. A test now rejects any nested fragment, so the prompt cannot regress into a shape that does not render.

POST_MERGE_PASSES / runPostMergeSuite are replaced by runPostMerge / renderPostMergePrompt. The three preset modules are untouched, the dashboard buttons still use them. 530 pass, 0 fail, typecheck green across all 21 packages.

On setReadyForMerge(), a --post-merge run fired maintainability,
readability and security-audit as three child runs on the spot. It now
fires one turn that appends the follow-ups to the session TODO file, for
the backlog loop to pick up, which is what the #326 doc says.

The post-merge prompt is flattened rather than verbatim: the doc nests a
fragment inside a fragment, which the non-greedy fragment regex cannot
parse. Same branch, same output, one fragment.
@suleimansh suleimansh added enhancement New feature or request priority: medium Worth doing, not urgent the-framework ♻️ labels Jul 15, 2026
@suleimansh suleimansh self-assigned this Jul 15, 2026
@suleimansh suleimansh marked this pull request as ready for review July 15, 2026 21:24
@suleimansh suleimansh merged commit cfdbd59 into main Jul 15, 2026
2 checks passed
@suleimansh suleimansh deleted the feat/post-merge-todo-entries-556 branch July 15, 2026 21:24
suleimansh added a commit that referenced this pull request Jul 16, 2026
The backlog loop prompts through the run's own driver session, so a backlog
turn carries the same signal protocol as any other turn. promptItem only
parsed await gates, so everything else was dropped: showMarkdown() views never
reached the rail, setSessionName() was ignored, and setReadyForMerge() never
emitted ready-for-merge, which is what maybeFirePostMerge gates on. So
--post-merge could not fire from backlog work, now that the queue is where
post-merge writes its follow-ups (#558) and the knowledge docs (#537).

The cause was duplication: emitTurnSignals was byte-identical in run.ts and
prompt-run.ts, and the third turn site never got a copy. It is now one
createTurnSignalEmitter used by all three. The backlog loop keeps a single
emitter for the whole backlog, so ready-for-merge still fires once.

Closes #563
suleimansh added a commit that referenced this pull request Jul 16, 2026
…597)

* refactor(framework): preset prompts use ${{ tf.params.what }}, retire <PARAM:name> (#594)

Rom's updated #326 OP and the preset OPs switched the preset blank from
<PARAM:what> to ${{ tf.params.what }}, the same fragment syntax the system
prompt uses. Move the presets onto renderTemplate and delete the bespoke
preset-params.ts primitive, which is then fully unused.

render<Name>Prompt(what) is unchanged: byte-identical output for all 5
presets, default and custom, proven with a before/after render probe.

Prereq for #326's post-merge preset filePath entries.

Closes #594

* feat(framework): post-merge entries carry the preset filePath (#596)

Rom's updated #326 OP block 2 changed the post-merge TODO entries from a
bare preset name the agent had to guess to a real file it opens:

  Apply .the-framework/presets/maintainability.md with tf.params.what set
  to "changes introduced by <session>"

- new presets.ts: PRESETS registry (keyed by file stem, matching Rom's
  tf.presets.security_audit key), presetFilePath, presetContext,
  materializePresets
- installProject materializes the 5 presets into .the-framework/presets/*.md
  so filePath resolves; gitignored, so they track the framework version
- post-merge ## Maintenance re-flattened to Rom's OP block 2; drift snapshot
  updated (turns the drift check green)
- tf.presets.<name>.filePath plumbed through PostMergeContext, defaulted
  from presetContext()

Closes the fidelity gap #558 introduced. Proven end to end: install
materializes the files, and the rendered entry's filePath points at one
that exists on disk.

Closes #596
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: medium Worth doing, not urgent the-framework ♻️

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Post-merge prompt: add TODO entries instead of running the presets inline

1 participant